#!/usr/bin/python
# -*- coding: utf-8 -*-

# dic1 = {'name':'Tom', 'age':'31', 'sex':'man'}
#
# #修改
# dic1['name'] = 'lili'
# print(dic1)
# #新增
# dic1['country'] = 'China'
# print(dic1)
# #删除
# del dic1['age']
# print(dic1)
# #del dic1   删除字典
# #清除字典数据
# # dic1.clear()
# # print(dic1)
#
# #查找
# print(dic1['name'])
# #get
# print(dic1.get('id', '木有数据'))
# print(dic1.get('id'))
# print(dic1.get('name'))
#
# print(dic1.keys())
# print(dic1.values())
# print(dic1.items())

#循环遍历字典
dic1 = {'name':'Tom', 'age':'31', 'sex':'man'}
for a in dic1.keys():
    print(a)

for b in dic1.values():
    print(b)

for c in dic1.items():
    print(c)

for k, v in dic1.items():
    print('key是{0},value是{1}'.format(k, v))
